﻿@page "/diaryCardSetting"
@namespace SwashbucklerDiary.Pages
@inherits ImportantComponentBase

<MyAppBar Title="@(I18n.T("Setting.Display.DiaryCard.Name"))"
          OnClick="NavigateToBack">
</MyAppBar>

<ScrollContainer>
    <MCard Class="setting-card"
           Elevation="0"
           Rounded="@("lg")">
        <MListItem>
            <MListItemIcon>
                <MIcon Class="list-item-icon">
                    mdi-emoticon-happy-outline
                </MIcon>
            </MListItemIcon>
            <MListItemContent>
                @(I18n.T("Setting.Display.DiaryCard.Icon.Name"))
            </MListItemContent>
            <MListItemAction>
                <MSwitch @bind-Value="DiaryCardIcon"
                         TValue="bool"
                         OnChange="SettingChange(SettingType.DiaryCardIcon)"
                         Dense="true"
                         Inset="true"
                         Color="white"
                         TrackColor="@MSwitchTrackColor(DiaryCardIcon)">
                </MSwitch>
            </MListItemAction>
        </MListItem>

        <MDivider Class="mx-3"></MDivider>

        <MListItem OnClick="@(()=>ShowDiaryCardDateFormat=true)">
            <MListItemIcon>
                <MIcon Class="list-item-icon">
                    mdi-calendar-clock
                </MIcon>
            </MListItemIcon>
            <MListItemContent>
                @(I18n.T("Setting.Display.DiaryCard.DateFormat.Name"))
            </MListItemContent>
            <MListItemContent Class="setting-state">
                <MListItemSubtitle>
                    @(I18n.T(DiaryCardDateFormatKey))
                </MListItemSubtitle>
            </MListItemContent>
            <MListItemAction>
                <MIcon>mdi-chevron-right</MIcon>
            </MListItemAction>
        </MListItem>
    </MCard>
</ScrollContainer>

<RadioDialog @bind-Value="ShowDiaryCardDateFormat"
             Title="@(I18n.T("Setting.Display.DiaryCard.DateFormat.Name"))"
             ItemValue="DiaryCardDateFormat"
             TItemValue="string"
             ItemValueChanged="DiaryCardDateFormatChanged"
             Items="DiaryCardDateFormats">
</RadioDialog>
